<template>
	<view>
		<!-- <view class="en_top">
			<view class="flex_evenly en_list">
				<view class="en_item" :class="{'en_item_active':info.merchId==item.id}" @click="changeMerchId(item.id)" v-for="item in merch">{{item.name}}</view>
			</view>
			<view class="flex_evenly en_list">
				<view class="en_item" :class="{'en_item_active':info.enterpriseTypeId==item.id}" @click="changeEnType(item.id)" v-for="item in enterpriseType">{{item.name}}</view>
			</view>
		</view> -->
		<view class="en_step">
			<uni-steps :options="[{title: '完善信息'},{title: '初审'}, {title: '提报'}, {title: '实名'},{title: '开通成功'}]"
				:active="status"></uni-steps>
		</view>
		<view class="en_content" v-if="status==0">
			<view class="en_tit">基本信息</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>执照类型</view>
				<uni-data-select v-model="info.ent_type" :localdata="companyType"></uni-data-select>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>所属行业</view>
				<uni-data-picker placeholder="请选择" popup-title="请选择行业" :localdata="mccList" v-model="info.mcc">
				</uni-data-picker>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>营业执照全称</view>
				<input type="text" v-model="info.reg_name" class="en_input" placeholder="必须与企业证照上的名称一致">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>商户简称</view>
				<input type="text" v-model="info.short_name" class="en_input" placeholder="最少4个字符,展示在消费账单上,例如:海底捞火锅">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>店铺纸质小票名称</view>
				<input type="text" v-model="info.receipt_name" class="en_input" placeholder="小票名称展示在POS小票上,例如:海底捞火锅">
			</view>
			<!-- <view class="en_entry">
				<view class="en_field">商户英文名称</view>
				<input type="text" v-model="info.mer_en_name" class="en_input" placeholder="商户英文名称,示例值：huifupay">
			</view> -->
			<view class="en_tit">营业执照上传</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>证照图片</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.license_pic&&info.license_pic.length>0">
						<image :src="info.license_pic" @click="previewImg(0,info.license_pic)"></image>
						<text @click="deleteImg(index,'license_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('license_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>证照编号</view>
				<input type="text" v-model="info.license_code" class="en_input" placeholder="工商营业执照统一社会信用代码">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>证照类型</view>
				<uni-data-select v-model="info.license_type" :localdata="LicenseTypeList"></uni-data-select>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>证照有效期类型</view>
				<uni-data-select v-model="info.license_validity_type" :localdata="validityList"></uni-data-select>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>成立(注册)日期</view>
				<uni-datetime-picker type="date" :clear-icon="false" v-model="info.found_date" @maskClick="maskClick" />
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>证件有效期开始日期</view>
				<uni-datetime-picker type="date" :clear-icon="false" v-model="info.license_begin_date"
					@maskClick="maskClick" />
			</view>
			<view class="en_entry" v-show="info.license_validity_type==0">
				<view class="en_field"><text>*</text>证件有效期截止日期</view>
				<uni-datetime-picker type="date" :clear-icon="false" v-model="info.license_end_date"
					@maskClick="maskClick" />
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>注册地区</view>
				<uni-data-picker placeholder="请选择" popup-title="请选择注册区" :localdata="addressList"
					v-model="info.reg_district_id" @change="onchangeZc">
				</uni-data-picker>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>营业执照详细地址</view>
				<input type="text" v-model="info.reg_detail" class="en_input" placeholder="填执照上面的【经营场所】或【住所】">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>实际经营地区</view>
				<uni-data-picker placeholder="请选择" popup-title="请选择经营区" :localdata="addressList"
					v-model="info.district_id" @change="onchangeJy">
				</uni-data-picker>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>实际经营详细地址</view>
				<input type="text" v-model="info.detail_addr" class="en_input" placeholder="实际经营详细地址">
			</view>
			<view class="en_tit">法人证件上传</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>法人姓名</view>
				<input type="text" v-model="info.legal_name" class="en_input" placeholder="法人或负责人姓名,最大支持16个汉字">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>法人证件类型</view>
				<uni-data-select v-model="info.legal_cert_type" :localdata="legalcertList"></uni-data-select>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>法人证件号码</view>
				<input type="text" class="en_input" v-model="info.legal_cert_no" placeholder="如法人证件类型为00:身份证,则填写身份证号码">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>法人证件有效期类型</view>
				<uni-data-select v-model="info.legal_cert_validity_type" :localdata="validityList"></uni-data-select>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>法人证件有效期开始日期</view>
				<uni-datetime-picker type="date" :clear-icon="false" v-model="info.legal_cert_begin_date"
					@maskClick="maskClick" />
			</view>
			<view class="en_entry" v-show="info.legal_cert_validity_type==0">
				<view class="en_field"><text>*</text>法人证件有效期截止日期</view>
				<uni-datetime-picker type="date" :clear-icon="false" v-model="info.legal_cert_end_date"
					@maskClick="maskClick" />
			</view>
			<!-- <view class="en_entry">
				<view class="en_field">法人手机号</view>
				<input type="text" v-model="info.legal_mobile_no" class="en_input" placeholder="示例值：13911111111">
			</view> -->
			<view class="en_entry">
				<view class="en_field"><text>*</text>法人证件地址</view>
				<input type="text" v-model="info.legal_addr" class="en_input"
					placeholder="示例值:上海市徐汇区宜山路700号普天信息产业园2期C5栋">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>法人身份证国徽面</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.legal_cert_back_pic&&info.legal_cert_back_pic.length>0">
						<image :src="info.legal_cert_back_pic" @click="previewImg(0,info.legal_cert_back_pic)"></image>
						<text @click="deleteImg(index,'legal_cert_back_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('legal_cert_back_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>法人身份证人像面</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.legal_cert_front_pic&&info.legal_cert_front_pic.length>0">
						<image :src="info.legal_cert_front_pic" @click="previewImg(0,info.legal_cert_front_pic)">
						</image>
						<text @click="deleteImg(index,'legal_cert_front_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('legal_cert_front_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
			</view>
			<view class="en_entry">
				<view class="en_field">管理员姓名</view>
				<input type="text" v-model="info.contact_name" class="en_input" placeholder="默认法人姓名">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>管理员手机号</view>
				<input type="number" v-model="info.contact_mobile_no" class="en_input" placeholder="需为11位数字">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>管理员电子邮箱</view>
				<input type="text" v-model="info.contact_email" class="en_input" placeholder="需要带@,遵循邮箱格式">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>管理员账号(自定义)</view>
				<input type="text" v-model="info.login_name" class="en_input" placeholder="用于商户平台登录。可填手机号、字母、数字">
			</view>
			<!-- <view class="en_entry">
				<view class="en_field">客服电话</view>
				<input type="text" v-model="info.service_phone" class="en_input" placeholder="默认联系人手机号；示例值：021XXXXXXXX">
			</view> -->
			<view class="en_entry" v-show="info.ent_type==3">
				<view class="en_field">开户许可证</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.reg_acct_pic&&info.reg_acct_pic.length>0">
						<image :src="info.reg_acct_pic" @click="previewImg(0,info.reg_acct_pic)"></image>
						<text @click="deleteImg(index,'reg_acct_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('reg_acct_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
			</view>
			<view class="en_entry" v-show="info.ent_type==3">
				<view class="en_field">基本存款账户编号或核准号</view>
				<input type="text" v-model="info.open_licence_no" class="en_input" placeholder="基本存款账户编号或核准号">
			</view>
			<view class="en_tit">结算信息</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>银行账户类型</view>
				<uni-data-select v-model="info.card_type" :localdata="bankAccountList"></uni-data-select>
			</view>
			<view class="en_entry" v-show="info.card_type==1||info.card_type==2">
				<view class="en_field"><text>*</text>银行卡正面</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.settle_card_front_pic&&info.settle_card_front_pic.length>0">
						<image :src="info.settle_card_front_pic" @click="previewImg(0,info.settle_card_front_pic)">
						</image>
						<text @click="deleteImg(index,'settle_card_front_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('settle_card_front_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
			</view>
			<view class="en_entry" v-show="info.card_type==1||info.card_type==2">
				<view class="en_field"><text>*</text>持卡人身份证国徽面</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.settle_cert_back_pic&&info.settle_cert_back_pic.length>0">
						<image :src="info.settle_cert_back_pic" @click="previewImg(0,info.settle_cert_back_pic)">
						</image>
						<text @click="deleteImg(index,'settle_cert_back_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('settle_cert_back_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
			</view>
			<view class="en_entry" v-show="info.card_type==1||info.card_type==2">
				<view class="en_field"><text>*</text>持卡人身份证人像面</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.settle_cert_front_pic&&info.settle_cert_front_pic.length>0">
						<image :src="info.settle_cert_front_pic" @click="previewImg(0,info.settle_cert_front_pic)">
						</image>
						<text @click="deleteImg(index,'settle_cert_front_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('settle_cert_front_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
			</view>
			<view class="en_entry" v-show="info.card_type==2">
				<view class="en_field"><text>*</text>授权委托书</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.auth_enturst_pic&&info.auth_enturst_pic.length>0">
						<image :src="info.auth_enturst_pic" @click="previewImg(0,info.auth_enturst_pic)"></image>
						<text @click="deleteImg(index,'auth_enturst_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('auth_enturst_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
				<view class="en_field">委托书模板</view>
				<view class="flex_box wts">
					<image src="https://img.jinghushi.com/images/0/2025/01/J630D6rui00d93aLojarB0VN0bj6b0.png"
						mode="widthFix"></image>
					<button size="mini" class="wts_btn"
						@click="downImg('https://img.jinghushi.com/images/0/2025/01/J630D6rui00d93aLojarB0VN0bj6b0.png')">下载模板</button>
				</view>
			</view>
			<view class="en_entry" v-show="info.card_type==2">

			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>银行账户名(持卡人姓名)</view>
				<input type="text" v-model="info.card_name" class="en_input" placeholder="请输入银行账户名">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>银行账号</view>
				<input type="number" v-model="info.card_no" class="en_input" placeholder="请输入银行账号">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>银行所在市</view>
				<uni-data-picker placeholder="请选择" popup-title="请选择所在市" :localdata="addressAreaList"
					v-model="info.card_area_id" @change="onchangeYh">
				</uni-data-picker>
			</view>
			<view class="en_entry" v-show="info.card_type===0">
				<view class="en_field"><text>*</text>联行号</view>
				<input type="text" v-model="info.branch_code" class="en_input" placeholder="请输入联行号">
			</view>
			<view class="en_entry" v-show="info.card_type===0">
				<view class="en_field"><text>*</text>银行编码</view>
				<input type="text" v-model="info.bank_code" class="en_input" placeholder="请输入银行编码">
			</view>
			<view class="en_entry" v-show="info.card_type==1||info.card_type==2">
				<view class="en_field"><text>*</text>持卡人证件类型</view>
				<uni-data-select v-model="info.cert_type" :localdata="legalcertList"></uni-data-select>
			</view>
			<view class="en_entry" v-show="info.card_type==1||info.card_type==2">
				<view class="en_field"><text>*</text>持卡人证件号码</view>
				<input type="text" v-model="info.cert_no" class="en_input" placeholder="请输入持卡人证件号码">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>持卡人证件有效期类型</view>
				<uni-data-select v-model="info.cert_validity_type" :localdata="validityList"></uni-data-select>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>法人证件有效期开始日期</view>
				<uni-datetime-picker type="date" :clear-icon="false" v-model="info.cert_begin_date"
					@maskClick="maskClick" />
			</view>
			<view class="en_entry" v-show="info.cert_validity_type===0">
				<view class="en_field"><text>*</text>法人证件有效期截止日期</view>
				<uni-datetime-picker type="date" :clear-icon="false" v-model="info.cert_end_date"
					@maskClick="maskClick" />
			</view>
			<view class="en_entry">
				<view class="en_field">银行卡绑定手机号</view>
				<input type="text" v-model="info.mp" class="en_input" placeholder="11位数字，开通全域资金管理功能必填">
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>店铺门头照</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.store_header_pic&&info.store_header_pic.length>0">
						<image :src="info.store_header_pic" @click="previewImg(0,info.store_header_pic)"></image>
						<text @click="deleteImg(index,'store_header_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('store_header_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>店铺内景/工作区域照</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.store_indoor_pic&&info.store_indoor_pic.length>0">
						<image :src="info.store_indoor_pic" @click="previewImg(0,info.store_indoor_pic)"></image>
						<text @click="deleteImg(index,'store_indoor_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('store_indoor_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
			</view>
			<view class="en_entry">
				<view class="en_field"><text>*</text>收银台/前台照</view>
				<view class="f_imgs">
					<view class="f_img" v-if="info.store_cashier_desk_pic&&info.store_cashier_desk_pic.length>0">
						<image :src="info.store_cashier_desk_pic" @click="previewImg(0,info.store_cashier_desk_pic)">
						</image>
						<text @click="deleteImg(index,'store_cashier_desk_pic')">×</text>
					</view>
					<view class="f_img" v-else @click="selectGallery('store_cashier_desk_pic')">
						<image class="reaname_thumb_upload" src="/static/shizi.jpg"></image>
					</view>
				</view>
			</view>
			<!-- <view class="en_entry">
				<view class="en_field">备注</view>
				<input type="text" v-model="info.remarks" class="en_input" placeholder="备注">
			</view> -->
			<view class="totalBtn" @click="submit">提交</view>
		</view>
		<view class="en_status" v-if="status==1">
			<view class="en_s_tit" :class="{'en_s_tit2':auditStatus==-2}">{{statusInfo.msg}}</view>
			<!-- <block v-if="auditStatus==-2">
				<view class="en_s_reson">{{info.msg}}</view>
			</block> -->
			<view class="pub_tip" v-if="auditStatus==0">• 您的资料已提交，初审通过后，收到【汇付天下】短信并点击链接完成签约<br>• 关注 "汇付天下商户服务" 并进行绑定
			</view>
			<view class="totalBtn" @click="backStep">撤回，修改信息</view>
		</view>
		<view class="en_status" v-if="status==2">
			<view class="en_s_tit" :class="{'en_s_tit2':auditStatus==-3}">{{statusInfo.msg}}</view>
			<!-- <block v-if="auditStatus==-3">
				<view class="en_s_reson">{{info.msg}}</view>
			</block> -->
			<view class="totalBtn" v-if="auditStatus==-3" @click="backStep">撤回，修改信息</view>
		</view>
		<view class="en_status" v-if="status==3">
			<view v-if="statusInfo.msg" class="en_s_tit en_s_tit3">{{statusInfo.msg}}</view>
			<view v-if="scanInfo.flag==1||scanInfo.flag==3">
				<view class="flex_center text-center">
					<image src="/static/wx.png"></image>
					请使用微信扫码认证
				</view>
				<view class="en_status_mas">
					请截图后使用微信扫码认证
				</view>
				<image :src="scanInfo.qrcode_data" mode="widthFix"></image>
			</view>
			<view v-if="scanInfo.flag==2||scanInfo.flag==3">
				<view class="flex_center text-center">
					<image src="/static/user/zhifubao.png"></image>
					请使用支付宝扫码认证
				</view>
				<view class="en_status_mas">
					请截图后使用支付宝扫码认证
				</view>
				<image :src="scanInfo.zfbqrcode_data" mode="widthFix"></image>
			</view>

			<!-- <image src="https://mobilecodec.alipay.com/show.htm?code=2ie18189wgohahdeysakce5" mode="widthFix"></image> -->
		</view>
		<view class="en_status" v-if="status==4">
			<view class="en_s_tit en_s_tit3">{{statusInfo.msg}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				status: 0,
				auditStatus: -1, //审核状态  -1未提交 0初审中 1提报中 2实名认证 3进件完成 -2初审驳回 -3审核驳回
				scanInfo: [], //二维码信息
				merch: [ //商户类型
					{
						id: 1,
						name: '企业商户'
					},
					{
						id: 2,
						name: '个人商户'
					}
				],
				enterpriseType: [ //企业类型
					{
						id: 1,
						name: '实体'
					},
					{
						id: 2,
						name: '虚拟'
					}
				],
				companyType: [{
						value: 3,
						text: "私营企业"
					},
					{
						value: 5,
						text: "个体工商户"
					}
				], //公司类型
				mccList: [], //所属行业
				LicenseTypeList: [], //证照类型
				legalcertList: [], //法人证件类型
				addressList: [], //省市区
				addressAreaList: [], //省市
				validityList: [{
						value: 0,
						text: "非长期有效"
					},
					{
						value: 1,
						text: "长期有效"
					}
				],
				range: [{
						value: 0,
						text: "美容"
					},
					{
						value: 1,
						text: "餐饮"
					},
					{
						value: 2,
						text: "零售"
					},
				],
				bankAccountList: [{
						value: 0,
						text: "对公账户"
					},
					{
						value: 1,
						text: "对私法人账户"
					},
					{
						value: 2,
						text: "对私非法人账户"
					}
				],
				statusInfo: [],
				info: {
					reg_name: '', //营业执照全称
					short_name: '', //商户简称
					receipt_name: '', //店铺纸质小票名称
					mer_en_name: '', //商户英文名称
					ent_type: 0, //执照类型
					mcc: '', //所属行业
					license_pic: '', //证照照片
					license_code: '', //证照编号
					license_type: 'NATIONAL_LEGAL_MERGE', //证照类型
					license_validity_type: 1, //证照有效期类型
					license_begin_date: '', //证照有效期开始日期
					license_end_date: '', //证照有效期截止日期
					found_date: '', //成立(注册)日期
					reg_prov_id: '', //注册省
					reg_area_id: '', //注册市
					reg_district_id: '', //注册地区
					reg_detail: '', //注册详细地址
					prov_id: '', //经营省
					area_id: '', //经营市
					district_id: '', //经营区
					detail_addr: '', //经营详细地址
					legal_name: '', //法人姓名
					legal_cert_type: '00', //法人证件类型
					legal_cert_no: '', //法人证件号码
					legal_cert_validity_type: 0, //法人证件有效期类型
					legal_cert_begin_date: '', //法人证件有效期开始日期
					legal_cert_end_date: '', //法人证件有效期截止日期
					legal_mobile_no: '', //法人手机号
					legal_addr: '', //法人证件地址
					legal_cert_back_pic: '', //法人身份证国徽面
					legal_cert_front_pic: '', //法人身份证人像面
					contact_name: '', //管理员姓名
					contact_mobile_no: '', //管理员手机号
					contact_email: '', //管理员电子邮箱
					login_name: '', //管理员账号
					service_phone: '', //客服电话
					reg_acct_pic: '', //开户许可证
					open_licence_no: '', //基本存款账户编号或核准号
					card_type: '', //银行账户类型
					card_name: '', //银行账户名(持卡人姓名)
					card_no: '', //银行账号
					card_prov_id: '', //银行所在省
					card_area_id: '', //银行所在市
					bank_code: '', //银行编码
					branch_code: '', //联行号
					cert_type: '00', //持卡人证件类型
					cert_no: '', //持卡人证件号码
					cert_validity_type: 0, //持卡人证件有效期类型
					cert_begin_date: '', //	持卡人证件有效期开始日期
					cert_end_date: '', //持卡人证件有效期截止日期
					mp: '', //银行卡绑定手机号
					settle_card_front_pic: '', //卡正面
					settle_cert_back_pic: '', //持卡人身份证国徽面
					settle_cert_front_pic: '', //持卡人身份证人像面
					auth_enturst_pic: '', //授权委托书
					store_header_pic: '', //店铺门头照
					store_indoor_pic: '', //店铺内景/工作区域照
					store_cashier_desk_pic: '', //收银台/前台照
					remarks: '', //	备注
				},
			};
		},
		onLoad() {
			this.getMcc(); //所属行业
			this.getLicenseType(); //证照类型
			this.legalcert(); //法人证件类型
			this.getAddress(); //省市区
			this.getAddressArea(); //省市
			this.getInfo();
		},
		methods: {
			submit() {
				console.log(this.info)
				if (this.info.ent_type == '') return this.$api.msg('执照类型不能为空')
				if (this.info.mcc == '') return this.$api.msg('所属行业不能为空')
				if (this.info.reg_name == '') return this.$api.msg('营业执照全称(必须与企业证照上的名称一致)')
				if (this.info.short_name == '') return this.$api.msg('商户简称(最少4个字符，展示在消费账单上)')
				if (this.info.receipt_name == '') return this.$api.msg('店铺纸质小票名称(展示在POS小票上)')
				if (this.info.license_pic == '') return this.$api.msg('营业执照证照图片不能为空')
				if (this.info.license_code == '') return this.$api.msg('营业执照证照编号不能为空')
				if (this.info.license_type == '') return this.$api.msg('营业执照证照类型不能为空')
				if (this.info.license_validity_type === '') return this.$api.msg('营业执照证件有效期类型不能为空')
				if (this.info.found_date == '') return this.$api.msg('成立(注册)日期不能为空')
				if (this.info.license_begin_date == '') return this.$api.msg('营业执照证件有效期开始日期不能为空')
				if (this.info.license_validity_type === 0) {
					if (this.info.license_end_date == '') return this.$api.msg('营业执照证件有效期截止日期不能为空')
				}
				if (this.info.reg_district_id == '') return this.$api.msg('注册地区不能为空')
				if (this.info.reg_detail == '') return this.$api.msg('营业执照详细地址不能为空')
				if (this.info.district_id == '') return this.$api.msg('实际经营地区不能为空')
				if (this.info.detail_addr == '') return this.$api.msg('实际经营详细地址不能为空')
				if (this.info.legal_name == '') return this.$api.msg('法人姓名不能为空')
				if (this.info.legal_cert_type == '') return this.$api.msg('法人证件类型不能为空')
				if (this.info.legal_cert_no == '') return this.$api.msg('法人证件号码不能为空')
				if (this.info.legal_cert_validity_type === '') return this.$api.msg('法人证件有效期类型不能为空')
				if (this.info.legal_cert_begin_date == '') return this.$api.msg('法人证件有效期开始日期不能为空')
				if (this.info.legal_cert_validity_type === 0) {
					if (this.info.legal_cert_end_date == '') return this.$api.msg('法人证件有效期截止日期不能为空')
				}
				if (this.info.legal_addr == '') return this.$api.msg('法人证件地址不能为空')
				if (this.info.legal_cert_back_pic == '') return this.$api.msg('法人身份证国徽面不能为空')
				if (this.info.legal_cert_front_pic == '') return this.$api.msg('法人身份证人像面不能为空')
				if (this.info.contact_mobile_no == '') return this.$api.msg('管理员手机号需为11位数字')
				if (this.info.contact_email == '') return this.$api.msg('管理员电子邮箱(需要带@，遵循邮箱格式)')
				if (this.info.login_name == '') return this.$api.msg('管理员账号(用于商户平台登录。全局唯一。区分大小写)')
				if (this.info.card_type === '') return this.$api.msg('银行账户类型不能为空')
				if (this.info.card_name == '') return this.$api.msg('银行账户名(持卡人姓名)不能为空')
				if (this.info.card_no == '') return this.$api.msg('银行账号不能为空')
				if (this.info.card_area_id == '') return this.$api.msg('银行所在市不能为空')
				if (this.info.card_type == 0) {
					if (this.info.branch_code == '') return this.$api.msg('银行联行号不能为空')
					if (this.info.bank_code == '') return this.$api.msg('银行编码不能为空')
				}
				if (this.info.card_type == 1 || this.info.card_type == 2) {
					if (this.info.cert_type == '') return this.$api.msg('持卡人证件类型不能为空')
					if (this.info.cert_no == '') return this.$api.msg('持卡人证件号码不能为空')
					if (this.info.settle_card_front_pic == '') return this.$api.msg('银行卡正面不能为空')
					if (this.info.settle_cert_back_pic == '') return this.$api.msg('持卡人身份证国徽面不能为空')
					if (this.info.settle_cert_front_pic == '') return this.$api.msg('持卡人身份证人像面不能为空')
				}
				if (this.info.card_type == 2) {
					if (this.info.auth_enturst_pic == '') return this.$api.msg('授权委托书不能为空')
				}
				if (this.info.cert_validity_type === '') return this.$api.msg('持卡人证件有效期类型不能为空')
				if (this.info.cert_begin_date === '') return this.$api.msg('持卡人证件有效期开始日期不能为空')
				if (this.info.cert_validity_type == 0) {
					if (this.info.cert_end_date === '') return this.$api.msg('持卡人证件有效期截止日期不能为空')
				}
				if (this.info.store_header_pic == '') return this.$api.msg('店铺门头照不能为空')
				if (this.info.store_indoor_pic == '') return this.$api.msg('店铺内景/工作区域照不能为空')
				if (this.info.store_cashier_desk_pic == '') return this.$api.msg('收银台/前台照不能为空')

				let obj = JSON.parse(JSON.stringify(this.info));
				obj.found_date = obj.found_date.replace(/-/g, "");
				obj.legal_cert_begin_date = obj.legal_cert_begin_date.replace(/-/g, "");
				obj.legal_cert_end_date = obj.legal_cert_end_date.replace(/-/g, "");
				obj.cert_begin_date = obj.cert_begin_date.replace(/-/g, "");
				obj.cert_end_date = obj.cert_end_date.replace(/-/g, "");
				obj.license_begin_date = obj.license_begin_date.replace(/-/g, "");
				obj.license_end_date = obj.license_end_date.replace(/-/g, "");
				console.log(obj)
				// return;
				this.$axios('HfMerchantDataEnt/entry', 'POST', 'supplier', obj).then(res => {
					if (res.data.code == 200) {
						this.$api.msg(res.data.data);
						this.status = 1;
						this.getInfo();
					}
				})
			},
			onchangeZc(e) {
				this.info.reg_prov_id = e.detail.value[0].value;
				this.info.reg_area_id = e.detail.value[1].value;
			},
			onchangeJy(e) {
				this.info.prov_id = e.detail.value[0].value;
				this.info.area_id = e.detail.value[1].value;
			},
			onchangeYh(e) {
				this.info.card_prov_id = e.detail.value[0].value;
			},
			getInfo() {
				this.$axios('HfMerchantDataEnt/getShjjInfo', "POST", 'supplier').then(res => {
					if (res.data.code == 200) {
						if (res.data.data.info.id) {
							this.statusInfo = res.data.data;
							this.info = res.data.data.info;
							this.auditStatus = this.statusInfo.status;
							if (this.auditStatus == -1) {
								this.status = 0; //未提交过
							}
							if (this.auditStatus == 0 || this.auditStatus == -2) {
								this.status = 1; //初审
							}
							if (this.auditStatus == 1 || this.auditStatus == -3) {
								this.status = 2; //提报
							}
							if (this.auditStatus == 2) {
								this.status = 3; //实名
								this.getScanCode();
							}
							if (this.auditStatus == 3) {
								this.status = 4; //开通成功
							}
							// this.auditStatus = 3;//正式请注释 状态
							// this.status= 3;//正式请注释 状态
							this.info.ent_type = Number(this.info.ent_type)
							this.info.busi_type = Number(this.info.busi_type)
							this.info.card_type = Number(this.info.card_type)
							this.info.cert_validity_type = Number(this.info.cert_validity_type)
							this.info.legal_cert_validity_type = Number(this.info.legal_cert_validity_type)
							this.info.license_validity_type = Number(this.info.license_validity_type)
							this.info.license_begin_date = this.getDateTime(res.data.data.info.license_begin_date)
							this.info.license_end_date = this.getDateTime(res.data.data.info.license_end_date)
							this.info.cert_begin_date = this.getDateTime(res.data.data.info.cert_begin_date)
							this.info.cert_end_date = this.getDateTime(res.data.data.info.cert_end_date)
							this.info.found_date = this.getDateTime(res.data.data.info.found_date)
							this.info.legal_cert_begin_date = this.getDateTime(res.data.data.info
								.legal_cert_begin_date)
							this.info.legal_cert_end_date = this.getDateTime(res.data.data.info
								.legal_cert_end_date)
						}
					}
				})
			},
			getScanCode() {
				this.$axios('HfMerchantDataEnt/qyjjBusiRealnameQuery', 'POST', 'supplier').then(res => {
					if (res.data.code == 200) {
						this.scanInfo = res.data.data;
					}
				})
			},
			// submitScanCode(){
			// 	this.$axios('HfMerchantDataEnt/qyjjBusiRealname','POST','supplier').then(res=>{
			// 		if(res.data.code == 200){
			// 			this.status = 2;
			// 		}
			// 	})
			// },
			downImg(data) {
				var that = this;
				// 判断上次是否取消了授权
				uni.getSetting({
					success(res) {
						if (!res.authSetting['scope.writePhotosAlbum']) { //如果没有授权相册
							uni.authorize({
								scope: 'scope.writePhotosAlbum',
								success: () => {
									// 授权成功时的操作
									that.downloadImg(data);
								},
								fail: (err) => { //如果第一次点击了取消授权，第二次点击无法弹出授权框，走fail回调
									// 授权失败时的操作
									uni.showModal({ //要写一个confirm函数，否则不能触发uni.openSetting函数
										//提示
										title: '提示',
										content: '请授权，否则无法保存图片！',
										showCancel: true,
										cancelText: '取消',
										confirmText: '去授权',
										success: (res) => {
											if (res.confirm) {
												uni.openSetting({ //第二次之后，授权框弹不出来，需要跑到设置，手动打开授权开关
													success(settingdata) {
														if (settingdata
															.authSetting[
																'scope.writePhotoAlbum'
															]) {
															that.$api.msg('授权成功');
														} else {
															that.$api.msg(
																'未授权，无法保存到相册');
														}
													}
												})
											}
										}
									});
								}
							})
						} else {
							that.downloadImg(data);
						}
					}
				})
			},
			downloadImg(data) {
				let that = this;
				uni.downloadFile({
					url: data,
					success: res => {
						that.saveImg(res.tempFilePath);
					},
					fail: err => {
						that.$api.msg('保存失败');
					}
				});
			},
			saveImg(url) {
				let that = this;
				uni.saveImageToPhotosAlbum({
					filePath: url,
					success: () => {
						uni.showToast({
							title: '已保存到相册',
						})
					},
					fail: () => {
						that.$api.msg('保存失败');
					}
				});
			},
			backStep() {
				this.status = 0;
			},
			getDateTime(date) {
				if (date.length > 0) {
					let str = JSON.parse(JSON.stringify(date));
					let data = str.substring(0, 4) + '-' + str.substring(4, 6) + '-' + str.substring(str.length, str
						.length - 2);
					return data;
				} else {
					return '';
				}
			},
			// 所属行业接口
			getMcc() {
				this.$axios('HfMerchantDataEnt/getMcc', "POST", 'supplier').then(res => {
					if (res.data.code == 200) {
						this.mccList = res.data.data;
					}
				})
			},
			// 证照类型
			getLicenseType() {
				this.$axios('HfMerchantDataEnt/getLicenseType', "POST", 'supplier').then(res => {
					if (res.data.code == 200) {
						this.LicenseTypeList = Object.entries(res.data.data).map(([value, text]) => ({
							value,
							text
						}));;
					}
				})
			},
			// 法人证件类型
			legalcert() {
				this.$axios('HfMerchantDataEnt/getLegalCertType', "POST", 'supplier').then(res => {
					if (res.data.code == 200) {
						this.legalcertList = Object.entries(res.data.data).map(([value, text]) => ({
							value,
							text
						}));;
					}
				})
			},
			// 省市区
			getAddress() {
				this.$axios('HfMerchantDataEnt/getAddress', "POST", 'supplier').then(res => {
					if (res.data.code == 200) {
						this.addressList = res.data.data;
					}
				})
			},
			// 省市
			getAddressArea() {
				this.$axios('HfMerchantDataEnt/getAddressShort', "POST", 'supplier').then(res => {
					if (res.data.code == 200) {
						this.addressAreaList = res.data.data;
					}
				})
			},
			// 更改商户类型
			changeMerchId(id) {
				if (id == this.info.merchId) return;
				this.info.merchId = id;
			},
			// 更改经营类型
			changeEnType(id) {
				if (id == this.info.enterpriseTypeId) return;
				this.info.enterpriseTypeId = id;
			},
			// 更改公司类型
			changeCompanyType(e) {
				let index = e.detail.value;
				this.companyTypeId = index
				this.companyTypeName = this.companyType[index]
			},
			// 预览图片
			previewImg(idx, arr) {
				if (typeof arr === 'string') {
					let arrs = [];
					arrs.push(arr);
					arr = arrs;
				}
				uni.previewImage({
					current: idx,
					urls: arr
				})
			},
			// 删除图片
			deleteImg(e, type) {
				if (type == 'license_pic') this.info.license_pic = '';
				if (type == 'legal_cert_back_pic') this.info.legal_cert_back_pic = '';
				if (type == 'legal_cert_front_pic') this.info.legal_cert_front_pic = '';
				if (type == 'reg_acct_pic') this.info.reg_acct_pic = '';
				if (type == 'settle_card_front_pic') this.info.settle_card_front_pic = '';
				if (type == 'settle_cert_back_pic') this.info.settle_cert_back_pic = '';
				if (type == 'settle_cert_front_pic') this.info.settle_cert_front_pic = '';
				if (type == 'store_header_pic') this.info.store_header_pic = '';
				if (type == 'store_indoor_pic') this.info.store_indoor_pic = '';
				if (type == 'store_cashier_desk_pic') this.info.store_cashier_desk_pic = '';
				if (type == 'auth_enturst_pic') this.info.auth_enturst_pic = '';
			},
			// 选择图片弹窗
			selectGallery(type) {
				uni.chooseImage({
					count: 1,
					success: res => {
						this.realUpload(res.tempFilePaths[0], type);
					}
				})
			},
			// 上传服务器
			realUpload(image, type) {
				// console.log(image)
				var that = this;
				let arr = '';
				uni.showLoading({
					title: '上传中,请稍后'
				});
				uni.uploadFile({
					url: that.$url.state.url.upload,
					filePath: image,
					name: 'a',
					header: {
						token: uni.getStorageSync('token')
					},
					formData: {
						'file': 'a'
					},
					success: upres => {
						let data = JSON.parse(upres.data);
						if (data.code == 200) {
							arr = data.data.url;
							if (type == 'license_pic') that.info.license_pic = arr;
							if (type == 'legal_cert_back_pic') that.info.legal_cert_back_pic = arr;
							if (type == 'legal_cert_front_pic') that.info.legal_cert_front_pic = arr;
							if (type == 'reg_acct_pic') that.info.reg_acct_pic = arr;
							if (type == 'settle_card_front_pic') that.info.settle_card_front_pic = arr;
							if (type == 'settle_cert_back_pic') that.info.settle_cert_back_pic = arr;
							if (type == 'settle_cert_front_pic') that.info.settle_cert_front_pic = arr;
							if (type == 'store_header_pic') that.info.store_header_pic = arr;
							if (type == 'store_indoor_pic') that.info.store_indoor_pic = arr;
							if (type == 'store_cashier_desk_pic') that.info.store_cashier_desk_pic = arr;
							if (type == 'auth_enturst_pic') that.info.auth_enturst_pic = arr;
							uni.hideLoading();
						}
					},
					fail() {
						setTimeout(() => {
							that.$api.msg('上传失败，请重试')
							uni.hideLoading();
						}, 100)
					},
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #fbf8fe;
		padding-bottom: 180rpx;
	}

	.totalBtn {
		margin-top: 80rpx;
		position: static;
	}

	.en_top {
		padding: 20rpx 30rpx;

		.en_list {
			.en_item {
				background: #fff;
				border-radius: 12rpx;
				padding: 30rpx 30rpx;
				margin-bottom: 60rpx;
				font-size: 36rpx;
			}

			.en_item_active {
				background: $bg-color;
				color: #fff;
			}
		}
	}

	.en_step {
		padding: 20rpx 0 40rpx;
	}

	.en_status {
		padding: 0 40rpx;

		.en_status_mas {
			color: #da2e2e;
			text-align: center;
			font-size: 34rpx;
			margin-top: 16rpx;
		}

		.en_s_tit {
			text-align: center;
			color: #2979FF;
			font-size: 34rpx;
			margin-top: 30rpx;
			margin-bottom: 40rpx;
		}

		.en_s_tit2 {
			color: #da2e2e;
		}

		.en_s_tit3 {
			color: #108c10;
		}

		.en_s_reson {
			line-height: 60rpx;
			color: #2979FF;
			font-size: 30rpx;
		}

		image {
			width: 470rpx;
			// margin: 60rpx auto 0;
			margin: 30rpx auto 60rpx;
			display: block;
		}

		.en_s_account {
			color: #666;
			line-height: 60rpx;
		}

		.text-center image {
			width: 50rpx;
			height: 50rpx;
			margin: 0;
			margin-right: 10rpx;
		}
	}

	.en_content {
		margin: 0 30rpx;
		background: #fff;
		border-radius: 6rpx;
		padding: 20rpx;

		.en_tit {
			font-weight: bold;
			font-size: 30rpx;
			margin-bottom: 6rpx;
		}

		.en_entry {
			padding-left: 10rpx;
			margin-bottom: 20rpx;

			.en_field {
				margin: 14rpx 0;

				text {
					color: red;
					font-size: 24rpx;
					margin-right: 6rpx;
				}
			}

			.en_input {
				width: 100%;
				background: #f2f2f2;
				padding: 0 20rpx;
				height: 60rpx;
				line-height: 60rpx;
			}

			.uni-select {
				background: #f2f2f2;
				border: 1rpx solid #f2f2f2
			}
		}

		.f_imgs {
			width: 120rpx;
			height: 120rpx;
			margin-top: 20rpx;

			.f_img {
				width: 100%;
				height: 100%;
				position: relative;
			}

			image {
				width: 100%;
				height: 100%;
			}

			text {
				position: absolute;
				right: -10rpx;
				top: -26rpx;
				font-size: 40rpx;
			}
		}

		.wts {
			align-items: flex-end;

			image {
				width: 30%;
				border: 2rpx solid #eee;
			}

			.wts_btn {
				margin: 0;
				margin-left: 20rpx;
			}
		}
	}
</style>